bootstrap
Purpose
The bootstrap command is mainly intended to be used by other scripts and enables the ability to bootstrap a Grails application instance outside of the container for usage in tools that require a reference to Grails' ApplicationContextExamples of its usage include Grails' shell and consoleExamples
When used as an include you need to supply the following at the top of your Gant script:includeTargets << new File ( "${grailsHome}/scripts/Bootstrap.groovy" ) Once this is in place you can bootstrap Grails using two distinct methods:
loadApp - Loads and creates the GrailsApplication instance
configureApp - Loads all the Grails plug-ins and creates the Spring ApplicationContext
The loadApp command will create a grailsApp variable which you can the evaluate:loadApp()
grailsApp.allClasses.each { println it } The configureApp command will create pluginManager and appCtx variables representing the GrailsPluginManager instance and the Spring ApplicationContextconfigureApp()
Connection c = appCtx.getBean('dataSource').getConnection()
// do something with connectionDescription
Usage: